import org.srdbsql.*;

import java.sql.*;
import java.util.Properties;

/**
 * Created by kevin on 27/4/15.
 */

public class testOra {
    public static Connection getConnection() {
        //定义一个连接对象
        Connection conn = null;
        //定义连接数据库的URL资源
        String url = "jdbc:oracle:thin:@192.168.59.103:1521:demo";
        //定义连接数据库的用户名称与密码
        String username = "test";
        String password = "test";
        //加载数据库连接驱动
        String className = "oracle.jdbc.driver.OracleDriver";
        try {
            Class.forName(className);
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //获取数据库的连接对象
        try {
            conn = DriverManager.getConnection(url, username, password);
            System.out.println("数据库连接建立成功...");
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //返回连接对象
        return conn;
    }

    public static void main(String[] args) {
//        Connection conn = getConnection();
//        try {
//            Statement sta = conn.createStatement();
//            ResultSet rs = sta.executeQuery("select id,his from testlong");
//            while (rs.next()) {
//                System.out.println(rs.getString(1) + " ==  " + rs.getString(2));
////                System.out.println(rs.getString(1) + " ==  ");
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

//        System.out.println();
//        String input = "I like Java,jAva is very easy and jaVa is so popular.";
//        String replacement="cccc";
//
//        System.out.println(input);
//        System.out.println(input.replaceAll("(?i)java", replacement));
    }


}
